package com.dd.action;

//Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
//Jad home page: http://kpdus.tripod.com/jad.html
//Decompiler options: packimports(3) fieldsfirst ansi space 
//Source File Name:   TopBaseAction.java

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.actions.DispatchAction;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.dd.dao.*;
import com.dd.service.*;

public class BaseAction extends DispatchAction {

	public BaseAction() {
	}

	public void isLogin(HttpServletRequest request) {

	}

	public static String JsonCharFilter(String sourceStr) {
		sourceStr = sourceStr.replace("\\", "\\\\");
		sourceStr = sourceStr.replace("\b", "\\\b");
		sourceStr = sourceStr.replace("\t", "\\\t");
		sourceStr = sourceStr.replace("\n", "\\\n");
		sourceStr = sourceStr.replace("\n", "\\\n");
		sourceStr = sourceStr.replace("\f", "\\\f");
		sourceStr = sourceStr.replace("\r", "\\\r");
		return sourceStr.replace("\"", "\\\"");
	}

	public String clearStr(String str) {
		try {
			str = str.replace("\"", "'").replace("\r\n", "").replace("\r", "")
					.replace("\n", "");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return str;
	}

	public static String getDateStr(Date date) {
		String str = "";
		try {
			if (date == null) {
				return str;
			}
			str = new SimpleDateFormat("yyyy-MM-dd").format(date).toString();
			return str;
		} catch (Exception e) {
			return str;
		}
	}

	public String EncodeStr(String input) {
		try {
			input = URLEncoder.encode(input, "UTF-8").replace("+", "%20");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			input = "";
		}
		return input;
	}

	public Object getBean(String name) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(servlet.getServletContext());
		return ctx.getBean(name);
	}

	public DdUserDAO getDdUserDAO() {
		return (DdUserDAO) this.getBean("DdUserDAO");
	}
	public DdActivityDAO getDdActivityDAO() {
		return (DdActivityDAO) this.getBean("DdActivityDAO");
	}
	public DdShopgoodsDAO getDdGoodDAO() {
		return (DdShopgoodsDAO) this.getBean("DdShopgoodsDAO");
	}

	public DdShopDAO getDdShopDAO() {
		return (DdShopDAO) this.getBean("DdShopDAO");
	}

	public UserService getUserService() {
		return (UserService) this.getBean("userService");
	}

	public DdUserpageDAO getDdUserpageDAO() {
		return (DdUserpageDAO) this.getBean("DdUserpageDAO");
	}

	public ShopService getShopService() {
		return (ShopService) this.getBean("shopService");
	}

	public DdUserorderDAO getDdUserorderDAO() {
		return (DdUserorderDAO) this.getBean("DdUserorderDAO");
	}

	public DdUserorder1DAO getDdUserorder1DAO() {
		return (DdUserorder1DAO) this.getBean("DdUserorder1DAO");
	}

	public DictDAO getDictDAO() {
		return (DictDAO) this.getBean("DictDAO");
	}

	public DdNodeDAO getDdNodeDAO() {
		return (DdNodeDAO) this.getBean("DdNodeDAO");
	}

	public DdOrderDAO getDdOrderDAO() {
		return (DdOrderDAO) this.getBean("DdOrderDAO");
	}

	public DdOrderGoodsDAO getDdOrderGoodsDAO() {
		return (DdOrderGoodsDAO) this.getBean("DdOrderGoodsDAO");
	}

	public DdSystemuserDAO getDdSystemuserDAO() {
		return (DdSystemuserDAO) this.getBean("DdSystemuserDAO");
	}

	public DdSmsDAO getDdSmsDAO() {
		return (DdSmsDAO) this.getBean("DdSmsDAO");
	}

	public DdKeywordDAO getDdKeywordDAO() {
		return (DdKeywordDAO) this.getBean("DdKeywordDAO");
	}

	public DdUserpayDAO getDdUserpayDAO() {
		return (DdUserpayDAO) this.getBean("DdUserpayDAO");
	}

	public DdShoprejectDAO getDdShoprejectDAO() {
		return (DdShoprejectDAO) this.getBean("DdShoprejectDAO");
	}
	//
}
